package controller.GoodsTable;

import dao.goodsMapper;
import entity.MsgResult;
import entity.goods;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import service.AddGoodsService;

import java.util.HashMap;

@Controller
public class AddGoodsController {
    @Autowired
    private AddGoodsService addGoodsService;

    @RequestMapping("/addGoods")
    @ResponseBody
    public MsgResult addGoods(goods goods){
        MsgResult msgResult = new MsgResult();
        boolean b = addGoodsService.addGoods(goods);
        if(b){
            msgResult.setFlag(1);
            msgResult.setMsg("添加商品成功");
            return msgResult;
        }
        msgResult.setFlag(1);
        msgResult.setMsg("添加商品失败");
        return msgResult;
    }
}
